<?php
/* explain:		logout system
 * Project:     marsems
 * File:        logon.php
 *
 * @ link 		http://www.marsems.com/admin/
 * @ Email		ldmmyx@hotmail.com
 * @ copyright 	2005  Ling Deming	
 * @ author 	ivan  Ling Deming
 * @ version 2.0
 */

/*----- import modules -----*/
//include_once ("../configure/config.inc.php");		//----- global var
include_once ("./configure/admin.config.inc.php");//-- local var
include_once("impl/LoginLogImpl.php");
include_once ("impl/SessionImpl.php");				//-- Session

$sessionImpl 	= new SessionImpl(DB_TAG_SYSTEM);				//-- session
$loginLogImpl	= new LoginLogImpl(DB_TAG_SYSTEM);				//----- logs

/*----- delete session -----*/
if($sessionImpl->isExisted()){
	
	$oLoginLog = $loginLogImpl->getLoginLog($sessionImpl->getLoginId());
	if(is_object($oLoginLog)){		
		$loginLogImpl->logout($oLoginLog->getId());
	}
	
	$sessionImpl->destroy();

}
header("Location: ./");
exit();
?>